package com.liruo.treasureattic.common.httpmsg.exception;

import com.liruo.treasureattic.common.httpmsg.result.Errno;

import java.io.Serial;

/**
 * @Author:liruo
 * @Date:2022-10-11-20:05:28
 * @Desc
 */
public class RedisException extends RuntimeException {
    @Serial
    private static final long serialVersionUID = -3303342124204166093L;

    private final int code;
    /**
     * 专门是redis没有key这个异常
     * @param key
     */
    public RedisException(String key) {
        this(Errno.NOT_EXISTS, "can not find the key " + key);
    }
    public RedisException(Errno error, String message) {
        super(message);
        this.code = error.getCode();
    }
}
